home *** CD-ROM | disk | FTP | other *** search
/ GIFs Galore 1993 September / Walnut Creek GIFs Galore CDROM WIN-MAC (Walnut Creek CDROM)(September 1993).iso / pc / viewers / msdos / pixit.arc / PIX640.ASM < prev    next >
Assembly Source File  |  1989-04-14  |  3KB  |  144 lines

  1.  
  2. comment #
  3.  
  4. pix640.exx displays the image that follows the code in the extended
  5. Paradise VGA 640x480 by 256 color mode.  The image is made using gifdcd
  6. from an appropriate .gif file.  For example, this will make paint.exe
  7. from paint.gif assuming paint.gif is a 640x480 .gif image:
  8.  
  9.         C>gifdcd/w paint
  10.         paint is 640x480x8 bits and 6 bits/color with a global color map
  11.          background color is 0
  12.          image: start 0/0 pixels from left/top, is 640x480 sequential
  13.           code size = 8 bits
  14.           decompressed image = 307200 pixels
  15.          file properly terminated
  16.  
  17.         C>copy pix640.exx/b+paint.pix/b paint.exe
  18.  
  19. To make the file pix640.exx, the pix640.exe program that this .asm file
  20. generates must be truncated.  Here are the commands (the responses for
  21. tasm and tlink are not shown):
  22.  
  23.         C>tasm pix640
  24.         C>tlink pix640
  25.         C>ren pix640.exe pix640.exx
  26.         C>debug pix640.exx
  27.         -rcx
  28.         CX B680
  29.         :370
  30.         -rbx
  31.         BX 0004
  32.         :0
  33.         -w
  34.         Writing 0370 bytes
  35.         -q
  36.         C>
  37.  
  38. If the program below is changed, the 370 value above must be changed.
  39. Use the search command in debug to find the first string of 0ah's.  That
  40. address minus 100h is the new value.  For example, the command:
  41.  
  42.         -s100lf000 a a a a a
  43.  
  44. will report 0470 for this program.
  45.  
  46. #
  47.  
  48. stk segment para stack
  49.  db 256 dup(?)
  50. stk ends
  51.  
  52. pix640 segment
  53.  assume cs:pix640,ds:nothing,es:nothing,ss:stk
  54. start:
  55.         ; select 640x480x8 VGA mode.
  56.   mov ax,5fh
  57.   int 10h
  58.         ; write 256 color palette.
  59.   mov ax,1012h
  60.   mov bx,0
  61.   mov cx,256
  62.   sub dx,dx
  63.   mov si,seg imgpal
  64.   mov es,si
  65.   assume es:nothing
  66.   int 10h
  67.         ; turn off screen.
  68.   mov dx,03c4h
  69.   mov al,1
  70.   out dx,al
  71.   inc dx
  72.   in al,dx
  73.   or al,020h
  74.   out dx,al
  75.         ; set up segment registers for copy.
  76.   cld
  77.   mov ax,0a000h
  78.   mov es,ax
  79.   assume es:nothing
  80.   mov ax,seg imgpix0
  81.   mov ds,ax
  82.   assume ds:nothing
  83.         ; unlock Paradise registers.
  84.   mov dx,03ceh
  85.   mov ax,050fh
  86.   out dx,ax
  87.         ; copy image to screen in five pieces.
  88.   mov ax,9
  89.  cplp:
  90.    out dx,ax
  91.    sub si,si
  92.    mov di,si
  93.    mov cx,(640*(480/5))/2
  94.    rep movsw
  95.    mov bx,ds
  96.    add bx,(640*(480/5))/16
  97.    mov ds,bx
  98.    add ah,(640*(480/5))/4096
  99.    cmp ah,5*((640*(480/5))/4096)
  100.    jb cplp
  101.   pop ds
  102.   assume ds:nothing
  103.         ; turn on screen.
  104.   mov dx,03c4h
  105.   mov al,1
  106.   out dx,al
  107.   inc dx
  108.   in al,dx
  109.   and al,0dfh
  110.   out dx,al
  111.         ; wait for keystroke.
  112.   mov ah,0
  113.   int 16h
  114.         ; restore screen and return.
  115.   mov ax,3
  116.   int 10h
  117.   mov ax,4c00h
  118.   int 21h
  119. pix640 ends
  120.  
  121. imghdr segment para
  122.   db 16 dup (10)
  123. imghdr ends
  124. imgpal segment para
  125.   db (3*256) dup (11)
  126. imgpal ends
  127. imgpix0 segment para
  128.   db (640*(480/5)) dup (0)
  129. imgpix0 ends
  130. imgpix1 segment para
  131.   db (640*(480/5)) dup (1)
  132. imgpix1 ends
  133. imgpix2 segment para
  134.   db (640*(480/5)) dup (2)
  135. imgpix2 ends
  136. imgpix3 segment para
  137.   db (640*(480/5)) dup (3)
  138. imgpix3 ends
  139. imgpix4 segment para
  140.   db (640*(480/5)) dup (4)
  141. imgpix4 ends
  142.  
  143. end start
  144.